<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page.sync="page"
               :permission="permissionList"
               :before-open="beforeOpen"
               v-model="form"
               ref="crud"
               @row-update="rowUpdate"
               @row-save="rowSave"
               @row-del="rowDel"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot="menuLeft">
        <el-button type="danger"
                   size="small"
                   icon="el-icon-delete"
                   plain
                   v-if="permission.simp1010012_delete"
                   @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>

<script>
  import {getList, getDetail, add, update, remove} from "@/api/demo/simp1010012";
  import {mapGetters} from "vuex";

  export default {
    data() {
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        selectionList: [],
        option: {
          headerAlign: 'center',    //列字段局中
          // align: 'center',       //数据值局中
          menu:false,     //取消显示操作栏
          addBtn:false,   //添加按钮隐藏
          searchSize: "small",//搜索控件的大小small/mini
          index: true,//是否显示表格序号（根据分页会自动计算，比如每页10行，到了第二页就会从11开始记数）
          indexLabel: "id",//序号的标题
          selection:false, //取消多选框
          stripe:true,    //显示斑马纹
          height:'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          viewBtn: true, 
          dialogClickModal: false,
          column: [
             {
              label: "查询时间",
               prop: "baltime",
                type: "date",
              // format: "yyyy-MM-dd hh:mm:ss",
              // valueFormat: "yyyy-MM-dd hh:mm:ss",
              format: "yyyy-MM",
              valueFormat: "yyyy-MM",
              searchRange:true,
              hide: true,  //列表不显示
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
              search: true,
              rules: [{
                required: true,
                message: "请输入统计日期",
                trigger: "blur",

                
              }]
            },
            {
              headerAlign: 'center',    //列字段局中
              // align: 'center',       //数据值局中
              label: "统计日期",
              prop: "baltime",
              rules: [{
                required: true,
                message: "请输入统计日期",
                trigger: "blur"
              }]
            },
            {
              label: "商户编码",
              prop: "srvno",
              rules: [{
                required: true,
                message: "请输入商户编码",
                trigger: "blur"
              }]
            },
            {
              label: "商户名称",
              prop: "sevname",
              rules: [{
                required: true,
                message: "请输入商户名称",
                trigger: "blur"
              }]
            },
            {
              label: "PSAM卡数量",
              prop: "psamcnt",
              rules: [{
                required: true,
                message: "请输入PSAM卡数量",
                trigger: "blur"
              }]
            },


             {
              label:'汇总统计',
              children:[{
                 label:'汇总卡种',
                 children:[
                   {
                  label: "汇总统计-交易笔数",
                  prop: "totalcnt",
                  rules: [{
                    required: true,
                    message: "请输入汇总统计-交易笔数",
                    trigger: "blur"
                  }],
                          
                   }, 
                   {
          label: "汇总统计-原票价",
          prop: "totalprice",
          rules: [{
            required: true,
            message: "请输入汇总统计-原票价",
            trigger: "blur"
          }]
        },
        {
          label: "汇总统计-实扣金额",
          prop: "totalcost",
          rules: [{
            required: true,
            message: "请输入汇总统计-实扣金额",
            trigger: "blur"
          }]
        },
        {
          label: "汇总统计-差额",
          prop: "totaldiff",
          rules: [{
            required: true,
            message: "请输入汇总统计-差额",
            trigger: "blur"
          }]
        },
          ]
        }]
     },


{
                label: '无票价优惠',
                 children: [{
              label: '全部卡种',
              children: [
            {
              label: "无优惠统计-交易笔数",
              prop: "nodiscnt",
              rules: [{
                required: true,
                message: "请输入无优惠统计-交易笔数",
                trigger: "blur"
              }]
            },
            {
              label: "无优惠统计-原票价",
              prop: "nodisprice",
              rules: [{
                required: true,
                message: "请输入无优惠统计-原票价",
                trigger: "blur"
              }]
            },
            {
              label: "无优惠统计-实扣金额",
              prop: "nodiscost",
              rules: [{
                required: true,
                message: "请输入无优惠统计-实扣金额",
                trigger: "blur"
              }]
            },
            {
              label: "无优惠统计-差额",
              prop: "nodisdiff",
              rules: [{
                required: true,
                message: "请输入无优惠统计-差额",
                trigger: "blur"
              }]
            },
            ]
            }]
            },



              {
                label:"票价优惠",
                children:[
                  {
                    label:"普通卡（15次后6折）",
                     children: [{
              label: "普通卡优惠统计-交易笔数(15次6折)",
              prop: "nmlccnt1",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-交易笔数(15次6折)",
                trigger: "blur"
              }]
            },
                {
                  label: "普通卡优惠统计-原票价(15次6折)",
                  prop: "nmlcprice1",
                  rules: [{
                    required: true,
                    message: "请输入普通卡优惠统计-原票价(15次6折)",
                    trigger: "blur"
                  }]
                },
            {
              label: "普通卡优惠统计-实扣金额(15次6折)",
              prop: "nmlccost1",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-实扣金额(15次6折)",
                trigger: "blur"
              }]
            },
            {
              label: "普通卡优惠统计-差额(15次6折)",
              prop: "nmlcdiff1",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-差额(15次6折)",
                trigger: "blur"
              }]
            },

                     ]
                  },
                  {
                     label:"普通卡（9折优惠）",
                     children:[
            {
              label: "普通卡优惠统计-交易笔数（9折优惠）",
              prop: "nmlccnt2",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-交易笔数（9折优惠）",
                trigger: "blur"
              }]
                  },
                  {
                    label: "普通卡优惠统计-原票价（9折优惠）",
                    prop: "nmlcprice2",
                    rules: [{
                      required: true,
                      message: "请输入普通卡优惠统计-原票价（9折优惠）",
                      trigger: "blur"
                    }]
                  },
            {
              label: "普通卡优惠统计-实扣金额（9折优惠）",
              prop: "nmlccost2",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-实扣金额（9折优惠）",
                trigger: "blur"
              }]
            },
            {
              label: "普通卡优惠统计-差额（9折优惠）",
              prop: "nmlcdiff2",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-差额（9折优惠）",
                trigger: "blur"
              }]
            }

                     ]
                  },
                  {
                     label: "普通卡（8折优惠）",
                     children:[
  {
              label: "普通卡优惠统计-交易笔数（8折优惠）",
              prop: "nmlccnt3",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-交易笔数（8折优惠）",
                trigger: "blur"
              }]
            },
            {
              label: "普通卡优惠统计-原票价（8折优惠）",
              prop: "nmlcprice3",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-原票价（8折优惠）",
                trigger: "blur"
              }]
            },
            {
              label: "普通卡优惠统计-实扣金额（8折优惠）",
              prop: "nmlccost3",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-实扣金额（8折优惠）",
                trigger: "blur"
              }]
            },
            {
              label: "普通卡优惠统计-差额（8折优惠）",
              prop: "nmlcdiff3",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-差额（8折优惠）",
                trigger: "blur"
              }]
            }
                     ]

                  },

                  {
                    label:"普通卡（5折优惠）",
                    children:[
                      {
              label: "普通卡优惠统计-交易笔数（5折优惠）",
              prop: "nmlccnt4",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-交易笔数（5折优惠）",
                trigger: "blur"
              }]
            },
            {
              label: "普通卡优惠统计-原票价（5折优惠）",
              prop: "nmlcprice4",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-原票价（5折优惠）",
                trigger: "blur"
              }]
                  },
                  {
                    label: "普通卡优惠统计-实扣金额（5折优惠）",
                    prop: "nmlccost4",
                    rules: [{
                      required: true,
                      message: "请输入普通卡优惠统计-实扣金额（5折优惠）",
                      trigger: "blur"
                    }]
                  },
            {
              label: "普通卡优惠统计-差额（5折优惠）",
              prop: "nmlcdiff4",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-差额（5折优惠）",
                      trigger: "blur"
                    }]
                  }

                    ]
                  },
                  {
                    label:"普通卡（单笔跨优惠）",
                    children:[
                        {
              label: "普通卡优惠统计-交易笔数（单笔跨优惠）",
              prop: "nmlccnt5",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-交易笔数（单笔跨优惠）",
                trigger: "blur"
              }]
            },
            {
              label: "普通卡优惠统计-原票价（单笔跨优惠）",
              prop: "nmlcprice5",
              rules: [{
                required: true,
                message: "请输入普通卡优惠统计-原票价（单笔跨优惠）",
                trigger: "blur"
              }]
                  },
                  {
                    label: "普通卡优惠统计-实扣金额（单笔跨优惠）",
                    prop: "nmlccost5",
                    rules: [{
                      required: true,
                      message: "请输入普通卡优惠统计-实扣金额（单笔跨优惠）",
                      trigger: "blur"
                    }]
            },
            {
                  label: "普通卡优惠统计-差额（单笔跨优惠）",
                  prop: "nmlcdiff5",
                  rules: [{
                    required: true,
                    message: "请输入普通卡优惠统计-差额（单笔跨优惠）",
                    trigger: "blur"
                  }]
                }
                    ]
                  },
                  {
                    label:"学生折扣卡",
                    children:[
                    {
                  label: "学生卡优惠统计-交易笔数",
                  prop: "stdccnt",
                  rules: [{
                    required: true,
                    message: "请输入学生卡优惠统计-交易笔数",
                    trigger: "blur"
                  }]
                },
            {
              label: "学生卡优惠统计-原票价",
              prop: "stdcprice",
              rules: [{
                required: true,
                message: "请输入学生卡优惠统计-原票价",
                trigger: "blur"
              }]
            },
            {
              label: "学生卡优惠统计-实扣金额",
              prop: "stdccost",
              rules: [{
                required: true,
                message: "请输入学生卡优惠统计-实扣金额",
                trigger: "blur"
              }]
            },
                  {
                    label: "学生卡优惠统计-差额",
                    prop: "stdcdiff",
                    rules: [{
                      required: true,
                      message: "请输入学生卡优惠统计-差额",
                      trigger: "blur"
                    }]
                  }

                    ]

                  },
                  {
                    label:"儿童全免卡",
                    children:[
        {
                      label: "儿童卡优惠统计-交易笔数",
                      prop: "chdccnt",
                      rules: [{
                        required: true,
                        message: "请输入儿童卡优惠统计-交易笔数",
                        trigger: "blur"
                      }]
                    },
            {
              label: "儿童卡优惠统计-原票价",
              prop: "chdcprice",
              rules: [{
                required: true,
                message: "请输入儿童卡优惠统计-原票价",
                trigger: "blur"
              }]
            },
            {
              label: "儿童卡优惠统计-实扣金额",
              prop: "chdccost",
              rules: [{
                required: true,
                message: "请输入儿童卡优惠统计-实扣金额",
                trigger: "blur"
              }]
            },
            {
              label: "儿童卡优惠统计-差额",
              prop: "chdcdiff",
              rules: [{
                required: true,
                message: "请输入儿童卡优惠统计-差额",
                trigger: "blur"
              }]
            }

                    ]
                  },
                  {
                    label:"残疾全免卡",
                    children:[
              {
              label: "残疾人半价优惠统计-交易笔数",
              prop: "crpchcnt",
              rules: [{
                required: true,
                message: "请输入残疾人半价优惠统计-交易笔数",
                trigger: "blur"
              }]
            },
            {
              label: "残疾人半价优惠统计-原票价",
              prop: "crpchprice",
              rules: [{
                required: true,
                message: "请输入残疾人半价优惠统计-原票价",
                trigger: "blur"
              }]
            },
            {
              label: "残疾人半价优惠统计-实扣金额",
              prop: "crpchcost",
              rules: [{
                required: true,
                message: "请输入残疾人半价优惠统计-实扣金额",
                trigger: "blur"
              }]
            },
            {
              label: "残疾人全免优惠统计-差额",
              prop: "crpchdiff",
              rules: [{
                required: true,
                message: "请输入残疾人全免优惠统计-差额",
                trigger: "blur"
              }]
            }

                    ]
                  },
                  {
                    label:"残疾半免卡",
                    children:[
            {
              label: "残疾人全免优惠统计-交易笔数",
              prop: "crpcfcnt",
              rules: [{
                required: true,
                message: "请输入残疾人全免优惠统计-交易笔数",
                trigger: "blur"
              }]
            },
            {
              label: "残疾人全免优惠统计-原票价",
              prop: "crpcfprice",
              rules: [{
                required: true,
                message: "请输入残疾人全免优惠统计-原票价",
                trigger: "blur"
              }]
            },
            {
              label: "残疾人全免优惠统计-实扣金额",
              prop: "crpcfcost",
              rules: [{
                required: true,
                message: "请输入残疾人全免优惠统计-实扣金额",
                trigger: "blur"
              }]
            },
            {
              label: "残疾人卡全免优惠统计-差额",
              prop: "crpcfdiff",
              rules: [{
                required: true,
                message: "请输入残疾人卡全免优惠统计-差额",
                trigger: "blur"
              }]
            }

                    ]
                  },
                  {
                    label:"老人全免卡",
                    children:[
            {
              label: "老人卡半价优惠统计-交易笔数",
              prop: "eldchcnt",
              rules: [{
                required: true,
                message: "请输入老人卡半价优惠统计-交易笔数",
                trigger: "blur"
              }]
            },
            {
              label: "老人卡半价优惠统计-原票价",
              prop: "eldchprice",
              rules: [{
                required: true,
                message: "请输入老人卡半价优惠统计-原票价",
                trigger: "blur"
              }]
            },
            {
              label: "老人卡半价优惠统计-实扣金额",
              prop: "eldchcost",
              rules: [{
                required: true,
                message: "请输入老人卡半价优惠统计-实扣金额",
                trigger: "blur"
              }]
            },
            {
              label: "老人卡半价优惠统计-差额",
              prop: "eldchdiff",
              rules: [{
                required: true,
                message: "请输入老人卡半价优惠统计-差额",
                trigger: "blur"
              }]
            }

                    ]
                  },

                  {
                    label:"老人半价卡",
                    children:[

            {
              label: "老人卡全免优惠统计-交易笔数",
              prop: "eldcfcnt",
              rules: [{
                required: true,
                message: "请输入老人卡全免优惠统计-交易笔数",
                trigger: "blur"
              }]
            },
            {
              label: "老人卡全免优惠统计-原票价",
              prop: "eldcfprice",
              rules: [{
                required: true,
                message: "请输入老人卡全免优惠统计-原票价",
                trigger: "blur"
              }]
            },
            {
              label: "老人卡全免优惠统计-实扣金额",
              prop: "eldcfcost",
              rules: [{
                required: true,
                message: "请输入老人卡全免优惠统计-实扣金额",
                trigger: "blur"
              }]
            },
            {
              label: "老人卡全免优惠统计-差额",
              prop: "eldcfdiff",
              rules: [{
                required: true,
                message: "请输入老人卡全免优惠统计-差额",
                trigger: "blur"
              }]
            }
                    ]
                  },
                  {
                    label:"新版老人全免卡",
                    children:[

            {
              label: "新版老人卡半价优惠统计-交易笔数",
              prop: "eldchcnt1",
              rules: [{
                required: true,
                message: "请输入新版老人卡半价优惠统计-交易笔数",
                trigger: "blur"
              }]
            },
            {
              label: "新版老人卡半价优惠统计-原票价",
              prop: "eldchprice1",
              rules: [{
                required: true,
                message: "请输入新版老人卡半价优惠统计-原票价",
                trigger: "blur"
              }]
            },
            {
              label: "新版老人卡半价优惠统计-实扣金额",
              prop: "eldchcost1",
              rules: [{
                required: true,
                message: "请输入新版老人卡半价优惠统计-实扣金额",
                trigger: "blur"
              }]
            },
            {
              label: "新版老人卡半价优惠统计-差额",
              prop: "eldchdiff1",
              rules: [{
                required: true,
                message: "请输入新版老人卡半价优惠统计-差额",
                trigger: "blur"
              }]
            }
                    ]
                  },
                  {
                    label:"新版老人半价卡",
                    children:[
                      {
              label: "新版老人卡全免优惠统计-交易笔数",
              prop: "eldcfcnt1",
              rules: [{
                required: true,
                message: "请输入新版老人卡全免优惠统计-交易笔数",
                trigger: "blur"
              }]
            },
            {
              label: "新版老人卡全免优惠统计-原票价",
              prop: "eldcfprice1",
              rules: [{
                required: true,
                message: "请输入新版老人卡全免优惠统计-原票价",
                trigger: "blur"
              }]
            },
            {
              label: "新版老人卡全免优惠统计-实扣金额",
              prop: "eldcfcost1",
              rules: [{
                required: true,
                message: "请输入新版老人卡全免优惠统计-实扣金额",
                trigger: "blur"
              }]
            },
            {
              label: "新版老人卡全免优惠统计-差额",
              prop: "eldcfdiff1",
              rules: [{
                required: true,
                message: "请输入新版老人卡全免优惠统计-差额",
                trigger: "blur"
              }]
            }

                    ]

                  },
                  {
                    label:"外埠老人全免卡 ",
                    children:[

            {
              label: "外埠老人卡半价优惠统计-交易笔数",
              prop: "eldchcnt2",
              rules: [{
                required: true,
                message: "请输入外埠老人卡半价优惠统计-交易笔数",
                trigger: "blur"
              }]
            },
            {
              label: "外埠老人卡半价优惠统计-原票价",
              prop: "eldchprice2",
              rules: [{
                required: true,
                message: "请输入外埠老人卡半价优惠统计-原票价",
                trigger: "blur"
              }]
            },
            {
              label: "外埠老人卡半价优惠统计-实扣金额",
              prop: "eldchcost2",
              rules: [{
                required: true,
                message: "请输入外埠老人卡半价优惠统计-实扣金额",
                trigger: "blur"
              }]
            },
            {
              label: "外埠老人卡半价优惠统计-差额",
              prop: "eldchdiff2",
              rules: [{
                required: true,
                message: "请输入外埠老人卡半价优惠统计-差额",
                trigger: "blur"
              }]
            }
                    ]


                  },
                  {
                    label:"外埠老人半价卡",
                    children:[
            {
              label: "外埠老人卡全免优惠统计-交易笔数",
              prop: "eldcfcnt2",
              rules: [{
                required: true,
                message: "请输入外埠老人卡全免优惠统计-交易笔数",
                trigger: "blur"
              }]
            },
            {
              label: "外埠老人卡全免优惠统计-原票价",
              prop: "eldcfprice2",
              rules: [{
                required: true,
                message: "请输入外埠老人卡全免优惠统计-原票价",
                trigger: "blur"
              }]
            },
            {
              label: "外埠老人卡全免优惠统计-实扣金额",
              prop: "eldcfcost2",
              rules: [{
                required: true,
                message: "请输入外埠老人卡全免优惠统计-实扣金额",
                trigger: "blur"
              }]
            },
            {
              label: "外埠老人卡全免优惠统计-差额",
              prop: "eldcfdiff2",
              rules: [{
                required: true,
                message: "请输入外埠老人卡全免优惠统计-差额",
                trigger: "blur"
              }]
            }

                    ]
                  },
                    {
                        label:"军优全免卡",
                        children:[
            {
              label: "军优卡全免优惠统计-交易笔数",
              prop: "mltccnt",
              rules: [{
                required: true,
                message: "请输入军优卡全免优惠统计-交易笔数",
                trigger: "blur"
              }]
            },
            {
              label: "军优卡全免优惠统计-原票价",
              prop: "mltcprice",
              rules: [{
                required: true,
                message: "请输入军优卡全免优惠统计-原票价",
                trigger: "blur"
              }]
            },
            {
              label: "军优卡全免优惠统计-实扣金额",
              prop: "mltccost",
              rules: [{
                required: true,
                message: "请输入军优卡全免优惠统计-实扣金额",
                trigger: "blur"
              }]
            },
            {
              label: "军优卡全免优惠统计-差额",
              prop: "mltcdiff",
              rules: [{
                required: true,
                message: "请输入军优卡全免优惠统计-差额",
                trigger: "blur"
              }]
            }

                        ]

                    },
                    {
                      label:"成人月票",
                      children:[
          {
              label: "成人月票统计-交易笔数",
              prop: "adtmcnt",
              rules: [{
                required: true,
                message: "请输入成人月票统计-交易笔数",
                trigger: "blur"
              }]
            },
            {
              label: "成人月票统计-原票价",
              prop: "adtmprice",
              rules: [{
                required: true,
                message: "请输入成人月票统计-原票价",
                trigger: "blur"
              }]
            },
            {
              label: "成人月票统计-实扣金额",
              prop: "adtmcost",
              rules: [{
                required: true,
                message: "请输入成人月票统计-实扣金额",
                trigger: "blur"
              }]
            },
            {
              label: "成人月票统计-差额",
              prop: "adtmdiff",
              rules: [{
                required: true,
                message: "请输入成人月票统计-差额",
                trigger: "blur"
              }]
                }

                      ]

                    },
                    {
                      label:"学生月票",
                      children:[
              {
              label: "学生月票统计-交易笔数",
              prop: "stdmcnt",
              rules: [{
                required: true,
                message: "请输入学生月票统计-交易笔数",
                trigger: "blur"
              }]
            },
            {
              label: "学生月票统计-原票价",
              prop: "stdmprice",
              rules: [{
                required: true,
                message: "请输入学生月票统计-原票价",
                trigger: "blur"
              }]
            },
            {
              label: "学生月票统计-实扣金额",
              prop: "stdmcost",
              rules: [{
                required: true,
                message: "请输入学生月票统计-实扣金额",
                trigger: "blur"
              }]
            },
            {
              label: "学生月票统计-差额",
              prop: "stdmdiff",
              rules: [{
                required: true,
                message: "请输入学生月票统计-差额",
                trigger: "blur"
              }]
            }
              ]
            }

        ]

      },
              
          ]
        },
        data: []
      };
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.simp1010012_add, false),
          viewBtn: this.vaildData(this.permission.simp1010012_view, false),
          delBtn: this.vaildData(this.permission.simp1010012_delete, false),
          editBtn: this.vaildData(this.permission.simp1010012_edit, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
    },
    methods: {
       dateFormat:function(time) {
          var date=new Date(time);
          var year=date.getFullYear();
          /* 在日期格式中，月份是从0开始的，因此要加0
          * 使用三元表达式在小于10的前面加0，以达到格式统一  如 09:11:05
          * */
          var month= date.getMonth()+1<10 ? "0"+(date.getMonth()+1) : date.getMonth()+1;
          var day=date.getDate()<10 ? "0"+date.getDate() : date.getDate();
          // var hours=date.getHours()<10 ? "0"+date.getHours() : date.getHours();
          // var minutes=date.getMinutes()<10 ? "0"+date.getMinutes() : date.getMinutes();
          // var seconds=date.getSeconds()<10 ? "0"+date.getSeconds() : date.getSeconds();
          // 拼接  
          // return year+"-"+month+"-"+day+" "+hours+":"+minutes+":"+seconds;
          return year+""+month;
      },
      rowSave(row, done, loading) {
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          loading();
          window.console.log(error);
        });
      },
      rowUpdate(row, index, done, loading) {
        update(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          loading();
          console.log(error);
        });
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        }
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.$refs.crud.toggleSelection();
          });
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getDetail(this.form.id).then(res => {
            this.form = res.data.data;
          });
        }
        done();
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
         const {baltime}=this.query;
        var values = {
          ...params,
        };
        if(baltime){
              console.log("检查11")
             console.log(baltime[0])  
          baltime[0]=this.dateFormat(baltime[0]);   
          baltime[1]=this.dateFormat(baltime[1]);   
              console.log("检查21")
             console.log(baltime[0])   

          values = {
            ...params,
            baltime_datege: baltime[0],
            
            baltime_datelt: baltime[1],  
            ...this.query
          }
          values.baltime=null;  
        }

        this.loading = true;
         getList(page.currentPage, page.pageSize, values).then(res => {
        // getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
    }
  };
</script>

<style>
</style>
